<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

$active_group = 'default';
$active_record = TRUE;

$common_db_config = array(
        "dbdriver"      =>      "mysql",
        "dbprefix"      =>      "",
        "pconnect"      =>      FALSE,
        "db_debug"      =>      TRUE,
        "cache_on"      =>      FALSE,
        "cachedir"      =>      "",
        "char_set"      =>      "utf8",
        "dbcollat"      =>      "utf8_general_ci",
        "swap_pre"      =>      "",
        "autoinit"      =>      TRUE,
        "stricton"      =>      FALSE
);

$db['k9ope'] = array_merge(array(
        "hostname"      => "10.4.14.110",
        "username"      => "k9ope",
        "password" => "k9_01",
        "database" => "k9ope"),
$common_db_config);

$slave_count = 1;
$k9_host_m   =   '10.4.14.110';
$k9_host_s   =   '10.4.14.110';



// k9pf db
$k9_pf_db =   "k9pf";
$k9_pf_db_user_m      =       $k9_pf_db;//."_m";
$k9_pf_db_pwd_m       =       "k9_01";
$k9_pf_db_user_s      =       $k9_pf_db;//."_s";
$k9_pf_db_pwd_s       =       "k9_01"; 

// k9push db
$k9_push_db =   "k9push";
$k9_push_db_user_m      =       $k9_push_db;//."_m";
$k9_push_db_pwd_m       =       "k9_01";
$k9_push_db_user_s      =       $k9_push_db;//."_s";
$k9_push_db_pwd_s       =       "k9_01"; 

// k9transaction db
$k9_transaction_db =   "k9transaction";
$k9_transaction_db_user_m      =       $k9_transaction_db;//."_m";
$k9_transaction_db_pwd_m       =       "k9_01";
$k9_transaction_db_user_s      =       $k9_transaction_db;//."_s";
$k9_transaction_db_pwd_s       =       "k9_01"; 

// k9openpf db
$k9_openpf_db =   "k9openpf";
$k9_openpf_db_user_m      =       $k9_openpf_db;//."_m";
$k9_openpf_db_pwd_m       =       "k9_01";
$k9_openpf_db_user_s      =       $k9_openpf_db;//."_s";
$k9_openpf_db_pwd_s       =       "k9_01"; 

// k9da db
$k9_da_db =   "k9da";
$k9_da_db_user_m      =       $k9_da_db;//."_m";
$k9_da_db_pwd_m       =       "k9_01";
$k9_da_db_user_s      =       $k9_da_db;//."_s";
$k9_da_db_pwd_s       =       "k9_01"; 

// k9dev db
$k9_dev_db =   "k9dev";
$k9_dev_db_user_m      =       $k9_dev_db;//."_m";
$k9_dev_db_pwd_m       =       "k9_01";
$k9_dev_db_user_s      =       $k9_dev_db;//."_s";
$k9_dev_db_pwd_s       =       "k9_01"; 

// k9official_ope db
$k9_official_ope_db =   "k9official_ope";
$k9_official_ope_db_user_m      =       $k9_official_ope_db;//."_m";
$k9_official_ope_db_pwd_m       =       "k9_01";
$k9_official_ope_db_user_s      =       $k9_official_ope_db;//."_s";
$k9_official_ope_db_pwd_s       =       "k9_01"; 

// read db of k9pf notification info
$DB_K9_PF_R = $k9_pf_db . "_r";
$slave_db_pf_config = array_merge ( array (
		"username" => "$k9_pf_db_user_s",
		"password" => "$k9_pf_db_pwd_s",
		"database" => "$k9_pf_db" 
), $common_db_config );  

// read db of k9push notification info
$DB_K9_PUSH_R = $k9_push_db . "_r";
$slave_db_push_config = array_merge ( array (
		"username" => "$k9_push_db_user_s",
		"password" => "$k9_push_db_pwd_s",
		"database" => "$k9_push_db" 
), $common_db_config );  

// read db of k9transaction notification info
$DB_K9_TRANSACTION_R = $k9_transaction_db . "_r";
$slave_db_transaction_config = array_merge ( array (
		"username" => "$k9_transaction_db_user_s",
		"password" => "$k9_transaction_db_pwd_s",
		"database" => "$k9_transaction_db" 
), $common_db_config );  

// read db of k9openpf notification info
$DB_K9_OPENPF_R = $k9_openpf_db . "_r";
$slave_db_openpf_config = array_merge ( array (
		"username" => "$k9_openpf_db_user_s",
		"password" => "$k9_openpf_db_pwd_s",
		"database" => "$k9_openpf_db" 
), $common_db_config );  

// read db of k9da notification info
$DB_K9_DA_R = $k9_da_db . "_r";
$slave_db_da_config = array_merge ( array (
		"username" => "$k9_da_db_user_s",
		"password" => "$k9_da_db_pwd_s",
		"database" => "$k9_da_db" 
), $common_db_config );  

// read db of k9dev notification info
$DB_K9_DEV_R = $k9_dev_db . "_r";
$slave_db_dev_config = array_merge ( array (
		"username" => "$k9_dev_db_user_s",
		"password" => "$k9_dev_db_pwd_s",
		"database" => "$k9_dev_db" 
), $common_db_config );  

// read db of k9official_ope notification info
$DB_K9_OFFICIAL_OPE_R = $k9_official_ope_db . "_r";
$slave_db_official_ope_config = array_merge ( array (
		"username" => "$k9_official_ope_db_user_s",
		"password" => "$k9_official_ope_db_pwd_s",
		"database" => "$k9_official_ope_db" 
), $common_db_config );  
for($i = 0; $i < $slave_count; $i ++) {
	$suffix = $i == 0 ? '' : $i;
	eval ( "\$slave_hostname = \$k9_host_s$suffix;" );
	$ci_db_pf_name = $DB_K9_PF_R . $suffix;
	$ci_db_push_name = $DB_K9_PUSH_R . $suffix;
	$ci_db_transaction_name = $DB_K9_TRANSACTION_R . $suffix;
	$ci_db_openpf_name = $DB_K9_OPENPF_R . $suffix;
	$ci_db_da_name = $DB_K9_DA_R . $suffix;
	$ci_db_dev_name = $DB_K9_DEV_R . $suffix;
	$ci_db_official_ope_name = $DB_K9_OFFICIAL_OPE_R . $suffix;

	$hostname = array (
			"hostname" => $slave_hostname 
	);
	$db [$ci_db_pf_name] = array_merge ( $hostname, $slave_db_pf_config );
	$db [$ci_db_push_name] = array_merge ( $hostname, $slave_db_push_config );
	$db [$ci_db_transaction_name] = array_merge ( $hostname, $slave_db_transaction_config );
	$db [$ci_db_openpf_name] = array_merge ( $hostname, $slave_db_openpf_config );
	$db [$ci_db_da_name] = array_merge ( $hostname, $slave_db_da_config );
	$db [$ci_db_dev_name] = array_merge ( $hostname, $slave_db_dev_config );
	$db [$ci_db_official_ope_name] = array_merge ( $hostname, $slave_db_official_ope_config );
	$db_k9pf_array [] = $ci_db_pf_name;
	$db_k9push_array [] = $ci_db_push_name;
	$db_k9transaction_array [] = $ci_db_transaction_name;
	$db_k9openpf_array [] = $ci_db_openpf_name;
	$db_k9da_array [] = $ci_db_da_name;
	$db_k9dev_array [] = $ci_db_dev_name;
	$db_k9official_ope_array [] = $ci_db_official_ope_name;
}
$ci = &get_instance();
$ci->config->set_item ( 'db_k9pf_array',$db_k9pf_array);
$ci->config->set_item ( 'db_k9push_array',$db_k9push_array);
$ci->config->set_item ( 'db_k9transaction_array',$db_k9transaction_array);
$ci->config->set_item ( 'db_k9openpf_array',$db_k9openpf_array);
$ci->config->set_item ( 'db_k9da_array',$db_k9da_array);
$ci->config->set_item ( 'db_k9dev_array',$db_k9dev_array);
$ci->config->set_item ( 'db_k9official_ope_array',$db_k9official_ope_array);
 
// write db of k9pf user info
$DB_K9_PF_W = $k9_pf_db.'_w';
$db[$DB_K9_PF_W] = array_merge(array(
	"hostname"	=> "$k9_host_m",
	"username"	=>	"$k9_pf_db_user_m",
	"password" 	=> 	"$k9_pf_db_pwd_m",
	"database" => "$k9_pf_db"),
$common_db_config);

 
// write db of k9push user info
$DB_K9_PUSH_W = $k9_push_db.'_w';
$db[$DB_K9_PUSH_W] = array_merge(array(
	"hostname"	=> "$k9_host_m",
	"username"	=>	"$k9_push_db_user_m",
	"password" 	=> 	"$k9_push_db_pwd_m",
	"database" => "$k9_push_db"),
$common_db_config);

 
// write db of k9transaction user info
$DB_K9_TRANSACTION_W = $k9_transaction_db.'_w';
$db[$DB_K9_TRANSACTION_W] = array_merge(array(
	"hostname"	=> "$k9_host_m",
	"username"	=>	"$k9_transaction_db_user_m",
	"password" 	=> 	"$k9_transaction_db_pwd_m",
	"database" => "$k9_transaction_db"),
$common_db_config);

 
// write db of k9openpf user info
$DB_K9_OPENPF_W = $k9_openpf_db.'_w';
$db[$DB_K9_OPENPF_W] = array_merge(array(
	"hostname"	=> "$k9_host_m",
	"username"	=>	"$k9_openpf_db_user_m",
	"password" 	=> 	"$k9_openpf_db_pwd_m",
	"database" => "$k9_openpf_db"),
$common_db_config);

 
// write db of k9da user info
$DB_K9_DA_W = $k9_da_db.'_w';
$db[$DB_K9_DA_W] = array_merge(array(
	"hostname"	=> "$k9_host_m",
	"username"	=>	"$k9_da_db_user_m",
	"password" 	=> 	"$k9_da_db_pwd_m",
	"database" => "$k9_da_db"),
$common_db_config);

 
// write db of k9dev user info
$DB_K9_DEV_W = $k9_dev_db.'_w';
$db[$DB_K9_DEV_W] = array_merge(array(
	"hostname"	=> "$k9_host_m",
	"username"	=>	"$k9_dev_db_user_m",
	"password" 	=> 	"$k9_dev_db_pwd_m",
	"database" => "$k9_dev_db"),
$common_db_config);

 
// write db of k9official_ope user info
$DB_K9_OFFICIAL_OPE_W = $k9_official_ope_db.'_w';
$db[$DB_K9_OFFICIAL_OPE_W] = array_merge(array(
	"hostname"	=> "$k9_host_m",
	"username"	=>	"$k9_official_ope_db_user_m",
	"password" 	=> 	"$k9_official_ope_db_pwd_m",
	"database" => "$k9_official_ope_db"),
$common_db_config);

